package blt.app_core.api.message;


import java.util.List;

import blt.app_core.api.base.bean.OAuth;
import blt.app_core.api.base.bean.State;
import blt.app_core.api.base.callback.ComBack;
import blt.app_core.api.impl.BaseImpl;
import blt.app_core.api.message.bean.BannerInfo;
import blt.app_core.api.message.bean.MessageInfo;
import blt.app_core.log.Logger;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

/**
 * Created by xgp on 2017/6/18.
 */

public class MessageImpl extends BaseImpl<MessageService> implements MessageApi {


    @Override
    public void getMsgList(int page, int size) {
        builderLoginRequest();
        mService.getMsgList(page, size, null).enqueue(new ComBack<MessageInfo>() {
            @Override
            protected void onSuccess(List<MessageInfo> data) {
                notifyClients(MessageApi.class, MessageApi.onMessage, data);
            }
        });

//        mService.getMsgList(1, 20, null).enqueue(new Callback<OAuth<MessageInfo>>() {
//            @Override
//            public void onResponse(Call<OAuth<MessageInfo>> call, Response<OAuth<MessageInfo>> response) {
//                if (response.body().errcode == 200) {
//                    List<MessageInfo> datas = response.body().data;
//
//                }
//            }
//
//            @Override
//            public void onFailure(Call<OAuth<MessageInfo>> call, Throwable t) {
//
//            }
//        });

    }

    @Override
    public void deleteMsg(int msgId) {
        mService.deleteMsg(msgId).enqueue(new Callback<State>() {
            @Override
            public void onResponse(Call<State> call, Response<State> response) {

            }

            @Override
            public void onFailure(Call<State> call, Throwable t) {

            }
        });
    }

    @Override
    public void lookMsg(int msgId) {
        mService.lookMsg(msgId).enqueue(new Callback<State>() {
            @Override
            public void onResponse(Call<State> call, Response<State> response) {

            }

            @Override
            public void onFailure(Call<State> call, Throwable t) {

            }
        });
    }

    @Override
    public void getWeather(String city) {
        getBaseWeather(city);
    }

}